<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <title>04_对象扩展</title>
</head>
<body>
<!--
1. Object.is(v1, v2)
  * 判断 2 个数据是否完全相等
2. Object.assign(target, source1, source2..)
  * 将源对象的属性复制到目标对象上
3. 直接操作 __proto__ 属性
  let obj2 = {};
  obj2.__proto__ = obj1;
-->
<script type="text/javascript">
  console.log(Object.is('abc', 'abc')); // true
  console.log(NaN == NaN); // false
  console.log(Object.is(NaN, NaN)); // true

  console.log(0 == -0); // true
  console.log(Object.is(0, -0)); // false

  // Object.assign(target, source1, source2..)
  let obj = {name: 'kobe', age: 39, c: {d: 2}};
  let obj1 = {};
  Object.assign(obj1, obj);
  console.log(obj1, obj1.name);

  // 直接操作 __proto__ 属性
  let obj3 = {name: 'anverson', age: 41};
  let obj4 = {};
  obj4.__proto__ = obj3;
  console.log(obj4, obj4.name, obj4.age);
</script>
</body>
</html>
